package com.ctshk.sapp.scenic.controller;


import com.ctshk.common.annotations.OperationLogAnnotation;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.OperationLogModel;
import com.ctshk.common.enums.OperationLogType;
import com.ctshk.rpc.scenic.req.AirshowApiSettingReq;
import com.ctshk.rpc.scenic.req.AirshowDistributorLoginReq;
import com.ctshk.rpc.scenic.req.AirshowDistributorSettingAddReq;
import com.ctshk.rpc.scenic.req.AirshowDistributorSettingReq;
import com.ctshk.rpc.scenic.service.IAirshowApiSettingService;
import com.ctshk.rpc.scenic.service.IAirshowDistributorSettingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.*;

import com.ctshk.common.web.support.BaseController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 谢诗宏
 * @since 2021-06-10
 */
@RestController
@RequestMapping("/airshow-distributor-setting")
@Api(value="航展代理商相关服务", tags="航展代理商相关服务")
public class AirshowDistributorSettingController extends BaseController {

    @DubboReference
    private IAirshowDistributorSettingService iAirshowDistributorSettingService;

    @ApiOperation(value = "查询全部代理商列表", notes = "查询全部代理商列表")
    @GetMapping(value = "/get-all-distributor-list")
    public Result getAllDistributorList() {
        return iAirshowDistributorSettingService.getAllDistributorList();
    }

    @ApiOperation(value="修改代理商信息", notes="修改代理商信息")
    @OperationLogAnnotation(operModul = OperationLogModel.TICKET, operType = OperationLogType.UPDATE, operTitle = "修改珠海航展代理商配置", operDesc = "修改珠海航展代理商配置")
    @PostMapping("/update-distributor-setting")
    public Result updateDistributorSetting(@RequestBody AirshowDistributorSettingReq airshowDistributorSettingReq){
        return iAirshowDistributorSettingService.updateDistributorSetting(airshowDistributorSettingReq);
    }

    @ApiOperation(value="添加分销商", notes="添加分销商")
    @OperationLogAnnotation(operModul = OperationLogModel.TICKET, operType = OperationLogType.ADD, operTitle = "新增珠海航展代理商", operDesc = "新增珠海航展代理商")
    @PostMapping("/add-distributor")
    public Result addDistributor(@RequestBody AirshowDistributorSettingAddReq airshowDistributorSettingAddReq){
        return iAirshowDistributorSettingService.addDistributor(airshowDistributorSettingAddReq);
    }

    @ApiOperation(value="分销商登录", notes="分销商登录")
    @OperationLogAnnotation(operModul = OperationLogModel.TICKET, operType = OperationLogType.LOGIN, operTitle = "珠海航展分销商登录", operDesc = "珠海航展分销商登录")
    @PostMapping("/distributor-login")
    public Result distributorLogin(@RequestBody AirshowDistributorLoginReq airshowDistributorSettingAddReq){
        return iAirshowDistributorSettingService.distributorLogin(airshowDistributorSettingAddReq);
    }

}
